﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Contacts.Models;

namespace Contacts.Views.Helpers {
  public static class SelectHelpers {
    public static SelectList GetPhoneTypes(string selectedValue) {
      var items = Enum.GetValues(typeof(PhoneType))
        .Cast<PhoneType>()
        .Select(p => new { ID = ((int)p).ToString(), Name = p.ToString() });
      return new SelectList(items, "ID", "Name", selectedValue);
    }
    public static SelectList GetEmailTypes(string selectedValue) {
      var items = Enum.GetValues(typeof(EmailType))
        .Cast<EmailType>()
        .Select(p => new { ID = ((int)p).ToString(), Name = p.ToString() });
      return new SelectList(items, "ID", "Name", selectedValue);
    }
  }
}